import request from '@/utils/request'
import Cookies from 'js-cookie'

// 查询案卷列表
export function loginInSuprvision(data) {
  return request({
    url: '/supervision/FrameSet/Login.aspx',
    method: 'get'
  }).then(res => {
    const str = 'ttt(pd.val(),'
    const index = res.indexOf(str)
    const result = res.slice(index + str.length, index + str.length + 3)
    return result
  }).then(res => {
    function ttt(a, r) { var s = a.length; if (s == 0) { return '' } var v = ''; for (var i = 0; i < s; i++) { var m = a.charCodeAt(i) + r; v += m + ' ' } return v }
    const txtUserName = 'qiukf'
    const txtPassword = ttt('Aa180218', parseInt(res))
    return request({
      url: '/supervision/FrameSet/Login.aspx',
      method: 'post',
      data: `__LASTFOCUS=&__EVENTTARGET=&__EVENTARGUMENT=&__VIEWSTATE=%2FwEPDwULLTE5NTc2ODU3NTMPFgQeBWRsdXJsBRQvRnJhbWVTZXQvTG9naW4uYXNweB4Fc3RhdGVlZBgBBR5fX0NvbnRyb2xzUmVxdWlyZVBvc3RCYWNrS2V5X18WAgUJQnRuX0xvZ2luBQpCdG5fQ2FuY2VsfKcSAwqKkuNmov%2FjJT%2BD6N50VjA%3D&txtUserName=${txtUserName}&txtPassword=${txtPassword}&Btn_Login.x=28&Btn_Login.y=9&__VIEWSTATEGENERATOR=26174042&__EVENTVALIDATION=%2FwEWBQKv9cibDAKl1bKzCQK1qbSRCwLjn%2B3cBAL4%2F70dqwgqzlxiAAPaZM4slbXJY1tdn%2F8%3D`,
      headers: {
        'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
      }
    })
  })
}
export function getPage(query) {
  return request({
    url: '/supervision/HZDCPage/HZDCPage/NFireR_LadjListPage.aspx',
    method: 'get',
    params: query
  })
}
